unit LDSEdit;

interface
uses
  Windows, Sysutils, Messages, Classes, Controls, StdCtrls, Math, Buttons,
  Graphics, Forms, DB, AYUtils, Menus, DBGrids, CHConst, ExtCtrls,
  CHEdit,LDSCheckBox;

type
   TLDSCustomEdit= class(TCHEdit)
   private
    FEditCheckBox : TLDSCheckBox;
   protected
    procedure SetName(const Value: TComponentName); override;
    procedure SetParent(AParent: TWinControl); override;
   public
    constructor Create(AOwner: TComponent); override;
    destructor Destroy; override;
    procedure SetBounds(ALeft: Integer; ATop: Integer; AWidth: Integer; AHeight: Integer); override;
  end;

  TLDSEdit= class(TLDSCustomEdit);


implementation

{ TLDSCustomEdit }

constructor TLDSCustomEdit.Create(AOwner: TComponent);
begin
  inherited Create(AOwner);
  FEditCheckBox := TLDSCheckBox.Create(AOwner);

end;

destructor TLDSCustomEdit.Destroy;
begin

  inherited Destroy;
end;

procedure TLDSCustomEdit.SetBounds(ALeft, ATop, AWidth, AHeight: Integer);
begin
  inherited SetBounds(ALeft, ATop, AWidth, AHeight);
  if Assigned(FEditCheckBox) then
  begin
    with FEditCheckBox do
    begin
      SetBounds(ALeft-Width,ATop,Width,AHeight);
    end;
  end;

end;

procedure TLDSCustomEdit.SetName(const Value: TComponentName);
begin
  inherited SetName(Value);
  FEditCheckBox.Name := 'FEditCheckBox_'+Value;
  
end;

procedure TLDSCustomEdit.SetParent(AParent: TWinControl);
begin
  inherited SetParent(AParent);
  if not Assigned(FEditCheckBox) then exit;
  FEditCheckBox.Parent := AParent;

end;

end.
